#include <SDL2/SDL.h>
#include <stdlib.h>
#include <GL/gl.h>
#include <SDL2/SDL_opengl.h>
#include <SDL2/SDL_thread.h>

#define bool unsigned char
#define true 1
#define false 0

#define Graphic_MaxBackground 16

#ifndef Graphic_h
#define Graphic_h

/* Input */
typedef struct {
    bool Mouse_1, Mouse_2, Mouse_3;
    int X, Y;
    int OldX, OldY;
    bool Up, Down, Right, Left;
    bool Quit;
} G_Input;

/* Mein eigener Rechteck */
typedef struct{
  int X, Y;
  int W, H;
} G_Rect;

/* Camera */
typedef struct{
  float X, Y;
  float MoveX, MoveY;
  int W, H;
  int MaxW, MaxH;
} G_Camera;

/* Mouse */
typedef struct{
  long X, Y;
} G_Mouse;

/* Image Datei */
typedef struct {
    GLuint *imageData;
	int	width;
	int	height;
} G_TextureImage;

/* Timer */
typedef struct {
    int Count;
} G_TimerCount;

#endif

extern int Graphic_Tile;

extern int Graphic_WorldWidth;
extern int Graphic_WorldHeight;

extern float Graphic_Zoom;

extern G_Input Input;
extern G_Mouse Mouse;

/* Init OpenGL */
int Graphic_Init();

/* Human */
int Graphic_InitGL();

/* Framenrate, Zeichnen, Input usw. */
int Graphic_Process();

/* Load */
int Graphic_LoadFiles();
void Graphic_LoadPlayer(int Index, int Frame);

/* Timer */
int Graphic_Timer(Uint32 intervall, void *parameter);

/* Thrend Graphic Input */
void Graphic_Input();

/* Zeichnen */
void Graphic_Draw(float X, float Y, int Layer, int Zentrieren);

/* Zeichnen einstellen */
void Graphic_Flip(bool X, bool Y);

/* Camera*/
void Graphic_Camera( int X, int Y);
void Graphic_SetCamera(int maxW, int maxH);
void Graphic_CentralCamera(int W, int H);
float Graphic_GetCamera( int XYorWH);
void Graphic_CalcZoom();

void Graphic_Circle(int X, int Y, float R, int Style);
void Graphic_Test(int X, int Y, float Zoom, char *Title);
void Graphic_BuildIcon(int X, int Y, float Zoom, char *Title);

/* Beenden */
void Graphic_Quit();
